package com.dl.zd;

import java.util.Scanner;

import com.test.Test;
import com.zc.*;
import org.dom4j.Element;

import com.dl.DL;
import com.dom4j.YM;
import com.dom4j.ZF;
//套餐变更
public class BG {
	public static void BG() {
		Element element = YM.zxSJH(DL.num,YM.root);
		Element cElement = element.element("密码");
		Element ccElement1 = cElement.element("用户名");
		Element ccElement2 = cElement.element("余额");
		String str = element.attributeValue("num");
		String pwd = cElement.attributeValue("password");
		String name = ccElement1.attributeValue("name");
		String num = ccElement2.attributeValue("num");
		int c = Integer.valueOf(num);
		System.out.println("请输入你想变更的套餐序列号");
		ZF.tcm();
		Scanner in = new Scanner(System.in);
		if (in.hasNextInt()) {
			int xl = in.nextInt();
			switch (xl) {
			case 1:
				if (c < 58) {
					System.out.println("金额不足");
					DL.DL();
				}else {
					c=c-58;
				}
				break;
			case 2:
				if (c < 68) {
					System.out.println("金额不足");
					DL.DL();
				}else {
					c=c-68;
				}
				break;
			case 3:
				if (c < 78) {
					System.out.println("金额不足");
					DL.DL();
				}else {
					c=c-78;
				}
				break;
			default:
				System.out.println("套餐内容选择错误");
				break;
			}

			YM.sc(DL.num);
			num=String.valueOf(c);
			YM.add(str, name, pwd, num, xl);
			System.out.println("更改完成");
			DL.DL();
		}
	}
}
